home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 June / EnigmA AMIGA RUN 08 (1996)(G.R. Edizioni)(IT)[!][issue 1996-06][EARSAN CD VII].iso / earcd / comm1 / intsdkss.lha / include / sys / stat.h < prev    next >
C/C++ Source or Header  |  1996-04-09  |  4KB  |  112 lines

  1. #ifndef _SYS_STAT_INCLUDED
  2. #define _SYS_STAT_INCLUDED
  3.  
  4. /*
  5. ** stat structure used by fstat() and stat()
  6. ** will not be compatible with your compiler's stat() and fstat()
  7. */
  8. #include <sys/types.h>
  9.  
  10. struct stat
  11. {
  12.     dev_t    st_dev;
  13.     ino_t    st_ino;
  14.     mode_t    st_mode;
  15.     nlink_t st_nlink;
  16.     unsigned short st_reserved1; /* old st_uid, replaced spare positions */
  17.     unsigned short st_reserved2; /* old st_gid, replaced spare positions */
  18.     dev_t    st_rdev;
  19.     off_t    st_size;
  20.     time_t    st_atime;
  21.     int    st_spare1;
  22.     time_t    st_mtime;
  23.     int    st_spare2;
  24.     time_t    st_ctime;
  25.     int    st_spare3;
  26.     long    st_blksize;
  27.     long    st_blocks;
  28.     unsigned int    st_pad:30;
  29.     unsigned int    st_acl:1;   /* set if there are optional ACL entries */
  30.     unsigned int    st_remote:1;    /* Set if file is remote */
  31.     dev_t    st_netdev;    /* ID of device containing */
  32.                 /* network special file */
  33.     ino_t    st_netino;    /* Inode number of network special file */
  34.     __cnode_t    st_cnode;
  35.     __cnode_t    st_rcnode;
  36.     /* The site where the network device lives            */
  37.     __site_t    st_netsite;
  38.     short    st_fstype;
  39.     /* Real device number of device containing the inode for this file*/
  40.     dev_t    st_realdev;
  41.     /* Steal three spare for the device site number           */
  42.     unsigned short    st_basemode;
  43.     unsigned short    st_spareshort;
  44.     uid_t    st_uid;
  45.     gid_t    st_gid;
  46. #define _SPARE4_SIZE 3
  47.     long    st_spare4[_SPARE4_SIZE];
  48. };
  49.  
  50. /* st_mode will have bits set as follows */
  51. /* the least significant 9 bits will be the unix
  52. ** rwxrwxrwx bits (octal 777).
  53. */
  54.  
  55. #ifndef S_IRWXU         /* fcntl.h might have already defined these */
  56. #define S_ISUID 0004000     /* set user ID on execution */
  57. #define S_ISGID 0002000     /* set group ID on execution */
  58.  
  59. #define S_IRWXU 0000700     /* read, write, execute permission (owner) */
  60. #define S_IRUSR 0000400     /* read permission (owner) */
  61. #define S_IWUSR 0000200     /* write permission (owner) */
  62. #define S_IXUSR 0000100     /* execute permission (owner) */
  63.  
  64. #define S_IRWXG 0000070     /* read, write, execute permission (group) */
  65. #define S_IRGRP 0000040     /* read permission (group) */
  66. #define S_IWGRP 0000020     /* write permission (group) */
  67. #define S_IXGRP 0000010     /* execute permission (group) */
  68.  
  69. #define S_IRWXO 0000007     /* read, write, execute permission (other) */
  70. #define S_IROTH 0000004     /* read permission (other) */
  71. #define S_IWOTH 0000002     /* write permission (other) */
  72. #define S_IXOTH 0000001     /* execute permission (other) */
  73. #endif /* S_IRWXU */
  74.  
  75. #define _S_IFMT   0170000    /* type of file */
  76. #define _S_IFREG  0100000    /* regular */
  77. #define _S_IFBLK  0060000    /* block special */
  78. #define _S_IFCHR  0020000    /* character special */
  79. #define _S_IFDIR  0040000    /* directory */
  80. #define _S_IFIFO  0010000    /* pipe or FIFO */
  81. #define S_IFMT      _S_IFMT    /* type of file */
  82. #define S_IFBLK   _S_IFBLK    /* block special */
  83. #define S_IFCHR   _S_IFCHR    /* character special */
  84. #define S_IFDIR   _S_IFDIR    /* directory */
  85. #define S_IFIFO   _S_IFIFO    /* pipe or FIFO */
  86. #define S_IFREG   _S_IFREG    /* regular */
  87.  
  88. #define S_IFSOCK  0140000    /* socket */
  89. #define S_IFLNK   0120000    /* symbolic link */
  90. #define S_IFNWK   0110000    /* network special */
  91.  
  92. #define S_ISDIR(_M)  ((_M & _S_IFMT)==_S_IFDIR) /* test for directory */
  93. #define S_ISCHR(_M)  ((_M & _S_IFMT)==_S_IFCHR) /* test for char special */
  94. #define S_ISBLK(_M)  ((_M & _S_IFMT)==_S_IFBLK) /* test for block special */
  95. #define S_ISREG(_M)  ((_M & _S_IFMT)==_S_IFREG) /* test for regular file */
  96. #define S_ISFIFO(_M) ((_M & _S_IFMT)==_S_IFIFO) /* test for pipe or FIFO */
  97. #define S_ISSOCK(_M) ((_M & S_IFMT)==S_IFSOCK)    /* test for socket */
  98. #define S_ISLNK(_M)  ((_M & S_IFMT)==S_IFLNK)    /* test for symbolic link */
  99.  
  100. #if 1 /* AMIGA */
  101. int stat (const char *name, struct stat *buf);
  102. int lstat (const char *name, struct stat *buf);
  103. int fstat (int fd, struct stat *buf);
  104.  
  105. #ifndef S_IREAD
  106. #define S_IREAD      S_IRUSR
  107. #define S_IWRITE     S_IWUSR
  108. #define S_IEXEC      S_IXUSR
  109. #endif
  110.  
  111. #endif    /* _SYS_STAT_INCLUDED */
  112.